package io.renren.modules.article.controller;

import io.renren.common.utils.R;
import io.renren.modules.article.entity.ArticleEntity;
import io.renren.modules.article.openfeign.ArticleOpenFeignService;
import io.renren.modules.article.openfeign.OssOpenFeignService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author 李涛
 * @date 2020-09-03 16:47
 */
@RestController
@RequestMapping("/article")
public class ArticleController {
    @Autowired
    private ArticleOpenFeignService articleOpenFeignService;

    @Autowired
    private OssOpenFeignService ossOpenFeignService;

    @RequestMapping("/list")
    public R list(@RequestParam Map<String,Object> parms){
        return articleOpenFeignService.listArticle(parms);
    }
    @RequestMapping("/test")
    public R test(@RequestParam("content") String content){
        System.out.println(content);
        return R.ok();
    }
    @RequestMapping("/save")
    public R save(@RequestBody ArticleEntity entity){
        return articleOpenFeignService.saveArticle(entity);
    }
    @RequestMapping("/oss/policy")
    public R policy(){
        return ossOpenFeignService.policy();
    }
}
